app.controller('home',function($scope,$http){
	$http.get('/api/v2/sliders',{
		params:{
			"client_type":"pc",
			"location":"home"
		}
	}).then(function(res){
//		console.log(res.data)
		$scope.lunbo=res.data
	}).catch(function(err){
		alert('获取失败')
	})
	$http.get('/api/v2/categories',{
		params:{
			'offset':0,
			'limit':4
		}
	}).then(function(res){
		$scope.muying=res.data
		$scope.muying[0].img='../../img/fenlei1-mob.png'
		$scope.muying[1].img='../../img/fenlei2-mob.png'
		$scope.muying[2].img='../../img/fenlei3-mob.png'
		$scope.muying[3].img='../../img/fenlei4-mob.png'
		if($scope.muying[4]){
		$scope.muying[4].img='../../img/fenlei5-mob.png'
		}
	}).catch(function(err){
		alert('获取失败')
	})
	$http.get('/api/v2/products/new',{
		params:{
			"offset":0,
			"limit":5
		}
	}).then(function(res){
		console.log(res.data)
		$scope.yase=res.data
	}).catch(function(err){
		alert('获取失败')
	})
	$http.get('/api/v2/products',{
		params:{
			"limit":5,
			"category_id":"kNylmZ"
		}
	}).then(function(res){
		console.log(res.data)
		$scope.qinzi=res.data
	}).catch(function(err){
		alert('获取失败')
	})
	$http.get('/api/v2/products',{
		params:{
			"limit":5,
			"category_id":"9nrwmJ"
		}
	}).then(function(res){
		console.log(res.data)
		$scope.meirong=res.data
	}).catch(function(err){
		alert('获取失败')
	})
	$http.get('/api/v2/products',{
		params:{
			"limit":5,
			"category_id":"pnjXNl"
		}
	}).then(function(res){
		console.log(res.data)
		$scope.shipin=res.data
	}).catch(function(err){
		alert('获取失败')
	})
	$http.get('/api/v2/products',{
		params:{
			"limit":5,
			"category_id":"WNedmD"
		}
	}).then(function(res){
		console.log(res.data)
		$scope.jujia=res.data
	}).catch(function(err){
		alert('获取失败')
	})
})